/*
 * @version: 
 * @Author: yu
 * @Date: 2023-06-26 13:37:21
 * @LastEditors: Andy
 * @LastEditTime: 2023-07-05 17:08:26
 */
import { get, post } from './http.js'

//!一、菜单管理
// 封装添加菜单请求
export const menuAdd = (data) => post('/api/menuadd', data)

// 菜单列表
export const menuList = (params) => get('/api/menulist', params)

// 删除菜单
export const menuDel = (data) => post('/api/menudelete', data)

// 获取菜单
export const menuOne = (params) => get('/api/menuinfo', params)

// 修改菜单
export const menuUpdate = (data) => post('/api/menuedit', data)

//!二、角色管理
//1.角色添加
export const roleAdd = (data) => post('/api/roleadd', data)

//2.角色列表
export const roleList = () => get('/api/rolelist')

//3.角色获取（一条）
export const roleInfo = (params) => get('/api/roleinfo', params)

//4.角色修改 
export const roleEdit = (data) => post('/api/roleedit', data)

//5.角色删除
export const roleDel = (data) => post('/api/roledelete', data)

//!三、管理员管理
//1.管理员添加
export const userAdd = (data) => post('/api/useradd', data)

//2.管理员总数（用于计算分页
export const userCount = () => get('/api/usercount')

//3.管理员列表（分页）
export const userList = (params) => get('/api/userlist', params)

//4.管理员获取（一条）
export const userInfo = (params) => get('/api/userinfo', params)

//5.管理员修改
export const userEdit = (data) => post('/api/useredit', data)

//6.管理员删除
export const userDel = (data) => post('/api/userdelete', data)

//7.管理员登录
export const userLogin = (data) => post('/api/userlogin', data)


//!四、商品分类管理
//1.商品分类添加
export const cateAdd = (data) => post('/api/cateadd', data, true)

//2.商品分类列表
export const cateList = (params) => get('/api/catelist', params)

//3.商品分类获取（一条）
export const cateInfo = (params) => get('/api/cateinfo', params)

//4.商品分类修改
export const cateEdit = (data) => post('/api/cateedit', data, true)

//5.商品分类删除
export const cateDel = (data) => post('/api/catedelete', data)

//!五、商品规格管理
//1.商品规格添加
export const specsAdd = (data) => post('/api/specsadd', data)

//2.商品规格总数（用于计算分页）
export const specsCount = () => get('/api/specscount')

//3.商品规格列表（分页）
export const specsList = (params) => get('/api/specslist', params)

//4.商品规格获取（一条）
export const specsInfo = (params) => get('/api/specsinfo', params)

//5.商品规格修改
export const specsEdit = (data) => post('/api/specsedit', data)

//6.商品规格删除
export const specsDel = (data) => post('/api/specsdelete', data)

//!六、商品管理
//1.商品添加
export const goodsAdd = (data) => post('/api/goodsadd', data, true)

//2.商品总数（用于计算分页）
export const goodsCount = () => get('/api/goodscount')

//3.商品列表（分页）
export const goodsList = (params) => get('/api/goodslist', params)

//4.商品获取（一条）
export const goodsInfo = (params) => get('/api/goodsinfo', params)

//5.商品修改
export const goodsEdit = (data) => post('/api/goodsedit', data, true)

//6.商品删除
export const goodsDel = (data) => post('/api/goodsdelete', data)

//!七、会员管理
//1.会员列表
export const memberList = (params) => get('/api/memberlist', params)

//2.会员获取（一条）
export const memberInfo = (params) => get('/api/memberinfo', params)

//3.会员修改
export const memberEdit = (data) => post('/api/memberedit', data)

//!八、轮播图管理
//1.轮播图添加
export const bannerAdd = (data) => post('/api/banneradd', data, true)

//2.轮播图列表
export const bannerList = () => get('/api/bannerlist')

//3.轮播图获取（一条）
export const bannerInfo = (params) => get('/api/bannerinfo', params)

//4.轮播图修改
export const bannerEdit = (data) => post('/api/banneredit', data, true)

//5.轮播图删除
export const bannerDel = (data) => post('/api/bannerdelete', data)

//!九、限时秒杀管理
//1.限时秒杀添加
export const seckAdd = (data) => post('/api/seckadd', data)

//2.限时秒杀列表 
export const seckList = () => get('/api/secklist')

//3.限时秒杀获取（一条）
export const seckInfo = (params) => get('/api/seckinfo', params)

//4.限时秒杀修改
export const seckEdit = (data) => post('/api/seckedit', data)

//5.限时秒杀删除
export const seckdelete = (data) => post('/api/seckdelete', data)

export const getList = (params) => get('/api/getgoodlist', params)